import { IPSApplication } from '../../app/ipsapplication';
import { IPSAppCounter } from '../../app/control/ipsapp-counter';
import { IPSAppDEDataExport } from '../../app/dataentity/ipsapp-dedata-export';
import { IPSAppDEDataImport } from '../../app/dataentity/ipsapp-dedata-import';
import { IPSAppDEMethod } from '../../app/dataentity/ipsapp-demethod';
import { IPSAppDEPrint } from '../../app/dataentity/ipsapp-deprint';
import { IPSAppDEUIAction } from '../../app/dataentity/ipsapp-deuiaction';
import { IPSAppDEUILogic } from '../../app/dataentity/ipsapp-deuilogic';
import { IPSAppDataEntity } from '../../app/dataentity/ipsapp-data-entity';
import { IPSAppUILogic } from '../../app/logic/ipsapp-uilogic';
import { IPSAppView } from '../../app/view/ipsapp-view';
import { IPSNavigateContext } from '../../control/ipsnavigate-context';
import { IPSNavigateParam } from '../../control/ipsnavigate-param';
import { IPSDEOPPriv } from '../priv/ipsdeoppriv';
import { IPSDEUIAction } from './ipsdeuiaction';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysImage } from '../../res/ipssys-image';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';
import { IPSUIAction } from '../../view/ipsuiaction';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEUIActionImpl extends PSModelObjectImpl implements IPSDEUIAction, IPSAppDEUIAction {
  get actionLevel(): 50 | 100 | 200 | 250 {
    return this.M.actionLevel != null ? this.M.actionLevel : 100;
  }

  get actionTarget(): 'SINGLEDATA' | 'SINGLEKEY' | 'MULTIDATA' | 'MULTIKEY' | 'NONE' {
    return this.M.actionTarget;
  }

  get noPrivDisplayMode(): 1 | 2 | 6 {
    return this.M.noPrivDisplayMode != null ? this.M.noPrivDisplayMode : 2;
  }

  protected cmpslanguageres: IPSLanguageRes | null = null;

  getCMPSLanguageRes(): IPSLanguageRes | null {
    if (this.cmpslanguageres != null) return this.cmpslanguageres;
    const value = this.M.getCMPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.cmpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getCMPSLanguageRes') as IPSLanguageRes;
    return this.cmpslanguageres;
  }

  get cMPSLanguageRes(): IPSLanguageRes | null {
    return this.getCMPSLanguageRes();
  }

  getCMPSLanguageResMust(): IPSLanguageRes {
    const value = this.getCMPSLanguageRes();
    if (value == null) {
      throw new Error('未指定确认信息语言资源');
    }
    return value;
  }

  protected cappslanguageres: IPSLanguageRes | null = null;

  getCapPSLanguageRes(): IPSLanguageRes | null {
    if (this.cappslanguageres != null) return this.cappslanguageres;
    const value = this.M.getCapPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.cappslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getCapPSLanguageRes') as IPSLanguageRes;
    return this.cappslanguageres;
  }

  get capPSLanguageRes(): IPSLanguageRes | null {
    return this.getCapPSLanguageRes();
  }

  getCapPSLanguageResMust(): IPSLanguageRes {
    const value = this.getCapPSLanguageRes();
    if (value == null) {
      throw new Error('未指定标题语言资源');
    }
    return value;
  }

  get caption(): string {
    return this.M.caption;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get confirmMsg(): string {
    return this.M.confirmMsg;
  }

  get contextJOString(): string {
    return this.M.contextJOString;
  }

  get counterId(): string {
    return this.M.counterId;
  }

  get dataAccessAction(): string {
    return this.M.dataAccessAction;
  }

  get dialogResult(): 'OK' | 'CANCEL' | 'YES' | 'NO' {
    return this.M.dialogResult;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get extendMode(): 0 | 2 {
    return this.M.extendMode != null ? this.M.extendMode : 0;
  }

  protected frontpsappview: IPSAppView | null = null;

  getFrontPSAppView(): IPSAppView | null {
    if (this.frontpsappview != null) return this.frontpsappview;
    const value = this.M.getFrontPSAppView;
    if (value == null) {
      return null;
    }
    const ipsapplication = this.getParentPSModelObject('app.IPSApplication') as IPSApplication;
    if (ipsapplication != null) {
      this.frontpsappview = ipsapplication.findPSAppView(value);
    }
    return this.frontpsappview;
  }

  get frontPSAppView(): IPSAppView | null {
    return this.getFrontPSAppView();
  }

  getFrontPSAppViewMust(): IPSAppView {
    const value = this.getFrontPSAppView();
    if (value == null) {
      throw new Error('未指定前端应用视图');
    }
    return value;
  }

  get frontProcessType(): 'WIZARD' | 'TOP' | 'PRINT' | 'DATAIMP' | 'DATAEXP' | 'OPENHTMLPAGE' | 'OTHER' {
    return this.M.frontProcessType;
  }

  get fullCodeName(): string {
    return this.M.fullCodeName;
  }

  get htmlPageUrl(): string {
    return this.M.htmlPageUrl;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected nextpsuiaction: IPSUIAction | null = null;

  getNextPSUIAction(): IPSUIAction | null {
    if (this.nextpsuiaction != null) return this.nextpsuiaction;
    const value = this.M.getNextPSUIAction;
    if (value == null) {
      return null;
    }
    this.nextpsuiaction = this.getPSModel4('view.IPSUIAction', value, 'getNextPSUIAction') as IPSUIAction;
    return this.nextpsuiaction;
  }

  get nextPSUIAction(): IPSUIAction | null {
    return this.getNextPSUIAction();
  }

  getNextPSUIActionMust(): IPSUIAction {
    const value = this.getNextPSUIAction();
    if (value == null) {
      throw new Error('未指定下一步界面行为');
    }
    return value;
  }

  get orderValue(): number {
    return this.M.orderValue != null ? this.M.orderValue : 99999;
  }

  protected psappcounter: IPSAppCounter | null = null;

  getPSAppCounter(): IPSAppCounter | null {
    if (this.psappcounter != null) return this.psappcounter;
    const value = this.M.getPSAppCounter;
    if (value == null) {
      return null;
    }
    const ipsapplication = this.getParentPSModelObject('app.IPSApplication') as IPSApplication;
    if (ipsapplication != null) {
      this.psappcounter = ipsapplication.findPSAppCounter(value);
    }
    return this.psappcounter;
  }

  get psAppCounter(): IPSAppCounter | null {
    return this.getPSAppCounter();
  }

  getPSAppCounterMust(): IPSAppCounter {
    const value = this.getPSAppCounter();
    if (value == null) {
      throw new Error('未指定应用计数器');
    }
    return value;
  }

  protected psappdedataexport: IPSAppDEDataExport | null = null;

  getPSAppDEDataExport(): IPSAppDEDataExport | null {
    if (this.psappdedataexport != null) return this.psappdedataexport;
    const value = this.M.getPSAppDEDataExport;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.psappdedataexport = ipsappdataentity.findPSAppDEDataExport(value);
    }
    return this.psappdedataexport;
  }

  get psAppDEDataExport(): IPSAppDEDataExport | null {
    return this.getPSAppDEDataExport();
  }

  getPSAppDEDataExportMust(): IPSAppDEDataExport {
    const value = this.getPSAppDEDataExport();
    if (value == null) {
      throw new Error('未指定应用实体数据导出');
    }
    return value;
  }

  protected psappdedataimport: IPSAppDEDataImport | null = null;

  getPSAppDEDataImport(): IPSAppDEDataImport | null {
    if (this.psappdedataimport != null) return this.psappdedataimport;
    const value = this.M.getPSAppDEDataImport;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.psappdedataimport = ipsappdataentity.findPSAppDEDataImport(value);
    }
    return this.psappdedataimport;
  }

  get psAppDEDataImport(): IPSAppDEDataImport | null {
    return this.getPSAppDEDataImport();
  }

  getPSAppDEDataImportMust(): IPSAppDEDataImport {
    const value = this.getPSAppDEDataImport();
    if (value == null) {
      throw new Error('未指定应用实体数据导入');
    }
    return value;
  }

  protected psappdemethod: IPSAppDEMethod | null = null;

  getPSAppDEMethod(): IPSAppDEMethod | null {
    if (this.psappdemethod != null) return this.psappdemethod;
    const value = this.M.getPSAppDEMethod;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.psappdemethod = ipsappdataentity.findPSAppDEMethod(value);
    }
    return this.psappdemethod;
  }

  get psAppDEMethod(): IPSAppDEMethod | null {
    return this.getPSAppDEMethod();
  }

  getPSAppDEMethodMust(): IPSAppDEMethod {
    const value = this.getPSAppDEMethod();
    if (value == null) {
      throw new Error('未指定应用实体方法');
    }
    return value;
  }

  protected psappdeprint: IPSAppDEPrint | null = null;

  getPSAppDEPrint(): IPSAppDEPrint | null {
    if (this.psappdeprint != null) return this.psappdeprint;
    const value = this.M.getPSAppDEPrint;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.psappdeprint = ipsappdataentity.findPSAppDEPrint(value);
    }
    return this.psappdeprint;
  }

  get psAppDEPrint(): IPSAppDEPrint | null {
    return this.getPSAppDEPrint();
  }

  getPSAppDEPrintMust(): IPSAppDEPrint {
    const value = this.getPSAppDEPrint();
    if (value == null) {
      throw new Error('未指定应用实体打印');
    }
    return value;
  }

  protected psappdeuilogic: IPSAppDEUILogic | null = null;

  getPSAppDEUILogic(): IPSAppDEUILogic | null {
    if (this.psappdeuilogic != null) return this.psappdeuilogic;
    const value = this.M.getPSAppDEUILogic;
    if (value == null) {
      return null;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.psappdeuilogic = ipsappdataentity.findPSAppDEUILogic(value);
    }
    return this.psappdeuilogic;
  }

  get psAppDEUILogic(): IPSAppDEUILogic | null {
    return this.getPSAppDEUILogic();
  }

  getPSAppDEUILogicMust(): IPSAppDEUILogic {
    const value = this.getPSAppDEUILogic();
    if (value == null) {
      throw new Error('未指定应用实体界面逻辑');
    }
    return value;
  }

  protected psappdataentity: IPSAppDataEntity | null = null;

  getPSAppDataEntity(): IPSAppDataEntity | null {
    if (this.psappdataentity != null) return this.psappdataentity;
    const value = this.M.getPSAppDataEntity;
    if (value == null) {
      return null;
    }
    this.psappdataentity = this.getPSModel4('app.dataentity.IPSAppDataEntity', value, 'getPSAppDataEntity') as IPSAppDataEntity;
    return this.psappdataentity;
  }

  get psAppDataEntity(): IPSAppDataEntity | null {
    return this.getPSAppDataEntity();
  }

  getPSAppDataEntityMust(): IPSAppDataEntity {
    const value = this.getPSAppDataEntity();
    if (value == null) {
      throw new Error('未指定应用实体');
    }
    return value;
  }

  protected psappuilogic: IPSAppUILogic | null = null;

  getPSAppUILogic(): IPSAppUILogic | null {
    if (this.psappuilogic != null) return this.psappuilogic;
    const value = this.M.getPSAppUILogic;
    if (value == null) {
      return null;
    }
    const ipsapplication = this.getParentPSModelObject('app.IPSApplication') as IPSApplication;
    if (ipsapplication != null) {
      this.psappuilogic = ipsapplication.findPSAppUILogic(value);
    }
    return this.psappuilogic;
  }

  get psAppUILogic(): IPSAppUILogic | null {
    return this.getPSAppUILogic();
  }

  getPSAppUILogicMust(): IPSAppUILogic {
    const value = this.getPSAppUILogic();
    if (value == null) {
      throw new Error('未指定应用预置界面逻辑');
    }
    return value;
  }

  protected psdeoppriv: IPSDEOPPriv | null = null;

  getPSDEOPPriv(): IPSDEOPPriv | null {
    if (this.psdeoppriv != null) return this.psdeoppriv;
    const value = this.M.getPSDEOPPriv;
    if (value == null) {
      return null;
    }
    this.psdeoppriv = this.getPSModel4('dataentity.priv.IPSDEOPPriv', value, 'getPSDEOPPriv') as IPSDEOPPriv;
    return this.psdeoppriv;
  }

  get psDEOPPriv(): IPSDEOPPriv | null {
    return this.getPSDEOPPriv();
  }

  getPSDEOPPrivMust(): IPSDEOPPriv {
    const value = this.getPSDEOPPriv();
    if (value == null) {
      throw new Error('未指定相关实体操作标识');
    }
    return value;
  }

  protected psnavigatecontexts: IPSNavigateContext[] | null = null;

  getPSNavigateContexts(): IPSNavigateContext[] | null {
    if (this.psnavigatecontexts == null) {
      this.psnavigatecontexts = this.fillChildListModel(this.M.getPSNavigateContexts, 'control.IPSNavigateContext') as IPSNavigateContext[];
    }
    return this.psnavigatecontexts;
  }

  get psNavigateContexts(): IPSNavigateContext[] | null {
    return this.getPSNavigateContexts();
  }

  findPSNavigateContext(objKey: any): IPSNavigateContext | null {
    return this.getPSModel5('control.IPSNavigateContext', this.getPSNavigateContexts(), objKey) as IPSNavigateContext;
  }

  protected psnavigateparams: IPSNavigateParam[] | null = null;

  getPSNavigateParams(): IPSNavigateParam[] | null {
    if (this.psnavigateparams == null) {
      this.psnavigateparams = this.fillChildListModel(this.M.getPSNavigateParams, 'control.IPSNavigateParam') as IPSNavigateParam[];
    }
    return this.psnavigateparams;
  }

  get psNavigateParams(): IPSNavigateParam[] | null {
    return this.getPSNavigateParams();
  }

  findPSNavigateParam(objKey: any): IPSNavigateParam | null {
    return this.getPSModel5('control.IPSNavigateParam', this.getPSNavigateParams(), objKey) as IPSNavigateParam;
  }

  protected pssysimage: IPSSysImage | null = null;

  getPSSysImage(): IPSSysImage | null {
    if (this.pssysimage != null) return this.pssysimage;
    const value = this.M.getPSSysImage;
    if (value == null) {
      return null;
    }
    this.pssysimage = this.getPSModel4('res.IPSSysImage', value, 'getPSSysImage') as IPSSysImage;
    return this.pssysimage;
  }

  get psSysImage(): IPSSysImage | null {
    return this.getPSSysImage();
  }

  getPSSysImageMust(): IPSSysImage {
    const value = this.getPSSysImage();
    if (value == null) {
      throw new Error('未指定界面行为图标对象');
    }
    return value;
  }

  protected pssyspfplugin: IPSSysPFPlugin | null = null;

  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    if (this.pssyspfplugin != null) return this.pssyspfplugin;
    const value = this.M.getPSSysPFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyspfplugin = this.getPSModel4('res.IPSSysPFPlugin', value, 'getPSSysPFPlugin') as IPSSysPFPlugin;
    return this.pssyspfplugin;
  }

  get psSysPFPlugin(): IPSSysPFPlugin | null {
    return this.getPSSysPFPlugin();
  }

  getPSSysPFPluginMust(): IPSSysPFPlugin {
    const value = this.getPSSysPFPlugin();
    if (value == null) {
      throw new Error('未指定前端扩展插件');
    }
    return value;
  }

  get paramItem(): string {
    return this.M.paramItem;
  }

  get predefinedType(): string {
    return this.M.predefinedType;
  }

  get refreshMode(): 0 | 1 | 2 | 3 {
    return this.M.refreshMode != null ? this.M.refreshMode : 0;
  }

  protected smpslanguageres: IPSLanguageRes | null = null;

  getSMPSLanguageRes(): IPSLanguageRes | null {
    if (this.smpslanguageres != null) return this.smpslanguageres;
    const value = this.M.getSMPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.smpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getSMPSLanguageRes') as IPSLanguageRes;
    return this.smpslanguageres;
  }

  get sMPSLanguageRes(): IPSLanguageRes | null {
    return this.getSMPSLanguageRes();
  }

  getSMPSLanguageResMust(): IPSLanguageRes {
    const value = this.getSMPSLanguageRes();
    if (value == null) {
      throw new Error('未指定成功信息语言资源');
    }
    return value;
  }

  get scriptCode(): string {
    return this.M.scriptCode;
  }

  get successMsg(): string {
    return this.M.successMsg;
  }

  get textItem(): string {
    return this.M.textItem;
  }

  get timeout(): number {
    return this.M.timeout;
  }

  get tooltip(): string {
    return this.M.tooltip;
  }

  protected tooltippslanguageres: IPSLanguageRes | null = null;

  getTooltipPSLanguageRes(): IPSLanguageRes | null {
    if (this.tooltippslanguageres != null) return this.tooltippslanguageres;
    const value = this.M.getTooltipPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.tooltippslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getTooltipPSLanguageRes') as IPSLanguageRes;
    return this.tooltippslanguageres;
  }

  get tooltipPSLanguageRes(): IPSLanguageRes | null {
    return this.getTooltipPSLanguageRes();
  }

  getTooltipPSLanguageResMust(): IPSLanguageRes {
    const value = this.getTooltipPSLanguageRes();
    if (value == null) {
      throw new Error('未指定操作提示语言资源');
    }
    return value;
  }

  get uIActionMode(): 'SYS' | 'FRONT' | 'BACKEND' | 'WFFRONT' | 'WFBACKEND' | 'CUSTOM' {
    return this.M.uIActionMode;
  }

  get uIActionParamJO(): IModel {
    return this.M.uIActionParamJO;
  }

  get uIActionTag(): string {
    return this.M.uIActionTag;
  }

  get uIActionType(): string {
    return this.M.uIActionType;
  }

  get uILogicAttachMode(): 'REPLACE' | 'AFTER' {
    return this.M.uILogicAttachMode;
  }

  get uILogicType(): string {
    return this.M.uILogicType;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get valueItem(): string {
    return this.M.valueItem;
  }

  get closeEditView(): boolean {
    return this.M.closeEditView != null ? this.M.closeEditView : false;
  }

  get closePopupView(): boolean {
    return this.M.closePopupView != null ? this.M.closePopupView : false;
  }

  get enableConfirm(): boolean {
    return this.M.enableConfirm != null ? this.M.enableConfirm : false;
  }

  get enableRuntimeModel(): boolean {
    return this.M.enableRuntimeModel != null ? this.M.enableRuntimeModel : false;
  }

  get enableToggleMode(): boolean {
    return this.M.enableToggleMode;
  }

  get globalUIAction(): boolean {
    return this.M.globalUIAction != null ? this.M.globalUIAction : false;
  }

  get group(): boolean {
    return this.M.group != null ? this.M.group : false;
  }

  get reloadData(): boolean {
    return this.M.reloadData != null ? this.M.reloadData : false;
  }

  get saveTargetFirst(): boolean {
    return this.M.saveTargetFirst != null ? this.M.saveTargetFirst : false;
  }

  get showBusyIndicator(): boolean {
    return this.M.showBusyIndicator != null ? this.M.showBusyIndicator : true;
  }

  get cls(): string {
    return 'PSDEUIActionImpl';
  }

  instanceof(cls: string): boolean {
    if (
      cls == 'IPSModelSortable' ||
      cls == 'app.IPSApplicationObject' ||
      cls == 'app.dataentity.IPSAppDEUIAction' ||
      cls == 'app.view.IPSAppUIAction' ||
      cls == 'dataentity.IPSDataEntityObject' ||
      cls == 'dataentity.uiaction.IPSDEUIAction'
    )
      return true;
    return super.instanceof(cls);
  }
}
